Skip to content

feat(health): add /health/dependencies with onchain_rpc_ms latency check#357

Merged
kilodesodiq-arch merged 1 commit into
ChainForgee:mainfrom
Preciousuche:feat/health-dependencies-clean
Jul 17, 2026
Merged

feat(health): add /health/dependencies with onchain_rpc_ms latency check#357
kilodesodiq-arch merged 1 commit into
ChainForgee:mainfrom
Preciousuche:feat/health-dependencies-clean

Conversation

@Preciousuche

Copy link
Copy Markdown
Contributor

Supersedes #344 (repackaged to remove unrelated files accidentally included by lint --fix).

**Closes #287

Summary

Adds a new GET /api/v1/health/dependencies endpoint that measures on-chain RPC latency and reports it as onchain_rpc_ms.

  • If the call exceeds the 5s threshold, overall status is degraded (still HTTP 200 — the service is alive, just slow, so monitoring can see the number).
  • If the call fails, status is down (HTTP 503).
  • The timing logic mirrors the existing checkOnchainContract() pattern in HealthService.

Note on getAdmin(): the issue references a getAdmin() RPC call, but OnchainAdapter doesn't currently expose one. I used the existing read-only getContractMetadata() call to measure latency and left a comment on the issue asking whether a dedicated getAdmin() method is preferred. Swapping it is a one-line change if so.

Testing

  • pnpm build (backend) passes — clean type-check.
  • pnpm test:e2e health passes:
PASS  test/health.e2e-spec.ts
  Health dependencies (e2e)
    √ /health/dependencies (GET) reports onchain_rpc_ms
Tests:       1 passed, 1 total

The e2e test overrides the on-chain adapter with a fast fake, so it verifies the endpoint's behaviour without touching a live network.

Checklist

  • Tests added for new behavior
  • Build passes locally
  • Follows existing code patterns**

Copy link
Copy Markdown
Contributor

Awesome work on this! Thanks for the contribution 🚀 Merging now.

@kilodesodiq-arch
kilodesodiq-arch merged commit ce2e8d3 into ChainForgee:main Jul 17, 2026
1 check passed
ifygreg01-best pushed a commit to ifygreg01-best/ChainForge that referenced this pull request Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Health check that proves the on-chain adapter is reachable at boot

3 participants